package p270jp.pxv.android.advertisement.presentation.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import androidx.constraintlayout.widget.ConstraintLayout;
import java.util.Objects;
import p062c4.ViewBindings;
import p064c6.Preconditions;
import p072ce.ViewGridSelfServeBinding;
import p130ee.SelfServeZone;
import p155fe.SelfServeService;
import p189gn.AbstractC3446l;
import p270jp.pxv.android.R;
import p270jp.pxv.android.commonObjects.model.SelfServeAdvertisement;
import p270jp.pxv.android.legacy.model.GoogleNg;
import p312le.C4645c;
import p312le.C4647e;
import p312le.C4648f;
import p312le.C4649g;
import p325m0.MutabilityOwnership;
import p350mp.Timber;
import p376no.Koin;
import p404oo.AbstractC5475a;
import p467rd.subscribers;
import p491sd.C6034a;
import p603wm.AbstractC6949c;
import p603wm.Unit;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;
import p671zc.Disposable;
import p675zg.SelfServeRepository;
import p677zi.PixivImageLoader;

/* compiled from: GridSelfServeView.kt */
/* renamed from: jp.pxv.android.advertisement.presentation.view.GridSelfServeView */
/* loaded from: classes2.dex */
public final class GridSelfServeView extends ConstraintLayout implements AbstractC5475a {

    /* renamed from: s */
    public final AbstractC6949c f18785s = Preconditions.m9802P(1, new C4647e(this, null, null));

    /* renamed from: t */
    public final AbstractC6949c f18786t = Preconditions.m9802P(1, new C4648f(this, null, null));

    /* renamed from: u */
    public final AbstractC6949c f18787u = Preconditions.m9802P(1, new C4649g(this, null, null));

    /* renamed from: v */
    public final ViewGridSelfServeBinding f18788v;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public GridSelfServeView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet, 0, 0);
        MutabilityOwnership.m3745m(context, "context");
        LayoutInflater.from(getContext()).inflate(R.layout.view_grid_self_serve, this);
        ImageView imageView = (ImageView) ViewBindings.m9835b(this, R.id.ad_image);
        if (imageView != null) {
            this.f18788v = new ViewGridSelfServeBinding(this, imageView, 0);
            return;
        }
        throw new NullPointerException("Missing required view with ID: ".concat(getResources().getResourceName(R.id.ad_image)));
    }

    public final CompositeDisposable getCompositeDisposable() {
        return (CompositeDisposable) this.f18785s.getValue();
    }

    private final PixivImageLoader getPixivImageLoader() {
        return (PixivImageLoader) this.f18787u.getValue();
    }

    public final SelfServeService getSelfServeService() {
        return (SelfServeService) this.f18786t.getValue();
    }

    /* renamed from: s */
    public static final void m4672s(GridSelfServeView gridSelfServeView, SelfServeAdvertisement selfServeAdvertisement) {
        PixivImageLoader pixivImageLoader = gridSelfServeView.getPixivImageLoader();
        Context context = gridSelfServeView.getContext();
        MutabilityOwnership.m3746l(context, "context");
        ImageView imageView = (ImageView) gridSelfServeView.f18788v.f5402c;
        MutabilityOwnership.m3746l(imageView, "binding.adImage");
        pixivImageLoader.m63c(context, imageView, selfServeAdvertisement.getAdImageUrl(), new C4645c(gridSelfServeView, selfServeAdvertisement));
    }

    /* renamed from: v */
    public static final void m4669v(GridSelfServeView gridSelfServeView, String str) {
        SelfServeService selfServeService = gridSelfServeView.getSelfServeService();
        Objects.requireNonNull(selfServeService);
        MutabilityOwnership.m3745m(str, "impUrl");
        SelfServeRepository cVar = selfServeService.f14515a;
        Objects.requireNonNull(cVar);
        Disposable f = subscribers.m2590f(cVar.f31478a.m3561a(str).m1008i(C6034a.f26178c).m1011f(AndroidSchedulers.m334a()), new AbstractC3446l<Throwable, Unit>(Timber.f23100a) { // from class: le.d
            @Override // p189gn.AbstractC3446l
            public Unit invoke(Throwable th) {
                ((Timber.C4879b) this.receiver).mo3514p(th);
                return Unit.f29503a;
            }
        }, null, 2);
        CompositeDisposable compositeDisposable = gridSelfServeView.getCompositeDisposable();
        MutabilityOwnership.m3744n(compositeDisposable, "compositeDisposable");
        compositeDisposable.mo82c(f);
    }

    @Override // p404oo.AbstractC5475a
    public Koin getKoin() {
        return AbstractC5475a.C5476a.m3211a(this);
    }

    /* renamed from: w */
    public final void m4668w() {
        getCompositeDisposable().m80f();
    }

    /* renamed from: x */
    public final void m4667x(GoogleNg googleNg) {
        MutabilityOwnership.m3745m(googleNg, "googleNg");
        SelfServeService selfServeService = getSelfServeService();
        SelfServeZone aVar = SelfServeZone.Grid;
        String string = getContext().getString(R.string.yufulight_language_setting);
        MutabilityOwnership.m3746l(string, "context.getString(jp.pxv…fulight_language_setting)");
        Disposable e = subscribers.m2591e(selfServeService.m6311b(googleNg, aVar, string).m961o(C6034a.f26178c).m966j(AndroidSchedulers.m334a()), new AbstractC3446l<Throwable, Unit>(Timber.f23100a) { // from class: jp.pxv.android.advertisement.presentation.view.GridSelfServeView.b
            @Override // p189gn.AbstractC3446l
            public Unit invoke(Throwable th) {
                ((Timber.C4879b) this.receiver).mo3527b(th);
                return Unit.f29503a;
            }
        }, new AbstractC3446l<SelfServeAdvertisement, Unit>(this) { // from class: jp.pxv.android.advertisement.presentation.view.GridSelfServeView.a
            @Override // p189gn.AbstractC3446l
            public Unit invoke(SelfServeAdvertisement selfServeAdvertisement) {
                SelfServeAdvertisement selfServeAdvertisement2 = selfServeAdvertisement;
                MutabilityOwnership.m3745m(selfServeAdvertisement2, "p0");
                GridSelfServeView.m4672s((GridSelfServeView) this.receiver, selfServeAdvertisement2);
                return Unit.f29503a;
            }
        });
        CompositeDisposable compositeDisposable = getCompositeDisposable();
        MutabilityOwnership.m3744n(compositeDisposable, "compositeDisposable");
        compositeDisposable.mo82c(e);
    }
}
